package algorithm;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

/**
 * A simple data type to hold the final classified data.
 * 
 * @author Dan Avila
 *
 */
public class SimpleClassification implements Classification{

	private List<Vector<Double>> inputs = new ArrayList<Vector<Double>>();

	public SimpleClassification()
	{
		super();
	}
	@Override
	public boolean addInput(Vector<Double> input)
	{
		return inputs.add(input);
	}

	@Override
	public boolean addInputs(Collection<Vector<Double>> input) 
	{
		return this.inputs.addAll(input);
	}
	
	@Override
	public Iterator<Vector<Double>> iterator()
	{
		return inputs.iterator();
	}
	
	public void print()
	{
		for(Vector<Double> input:inputs)
		{
			System.out.print("<");
			for(int i = 0;i< input.size()-1;i++)
			{
				System.out.print(input.get(i)+", ");
			}
			System.out.print(input.get(input.size()-1));
			
			System.out.print("> ");
		}
		System.out.println();
	}
	
	@Override
	public String toString()
	{
		String s = "";
		
		for(Vector<Double> input: inputs)
		{
			s += input.get(0);
			
			for(int i = 1; i < input.size(); i++)
			{
				s+="\t"+input.get(i);
			}
			
			s+="\n";
		}
		
		s+="\n";
		
		return s;
	}
}
